<%@page import="com.easyweb.model.NavBar"%>
<%@page import="java.util.Map"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<script>
	(function(){
	    var bp = document.createElement('script');
	    var curProtocol = window.location.protocol.split(':')[0];
	    if (curProtocol === 'https') {
	        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
	    }
	    else {
	        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
	    }
	    var s = document.getElementsByTagName("script")[0];
	    s.parentNode.insertBefore(bp, s);
	})();
</script>
<nav class="navbar navbar-default" role="navigation">
    <div class="container">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse"
                data-target="#example-navbar-collapse">
            <span class="sr-only">切换导航</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="<%=BASE_PATH%>index.html"><img alt="微儿博客" src="<%=IMG_PATH%>logo.png"/></a>
    </div>
    <div class="collapse navbar-collapse" id="example-navbar-collapse">
        <ul class="nav navbar-nav">
        	<%
        		Map<String,NavBar> navBar = (Map<String,NavBar>) request.getAttribute("navbar");
        		for(String id : navBar.keySet()){
        			if(navBar.get(id).getShowOnIndex()==2){
	        			%>
	        				<li><a target="_blank" href="<%=navBar.get(id).getUrl()%>"><i class="<%=navBar.get(id).getIcon()%>"></i><%=navBar.get(id).getTitle() %></a></li>
	        			<%
        			}else{
        				%>
	        				<li><a href="<%=navBar.get(id).getUrl()%>"><i class="<%=navBar.get(id).getIcon()%>"></i><%=navBar.get(id).getTitle() %></a></li>
	        			<%	
        			}
        		}
        	%>
        </ul>
        <div class="input-group col-sm-3 col-xs-11 nav-search pull-right">
			<input id="nav-search" placeholder="搜索..." type="text" class="form-control input-sm">
			<span id="nav-search-btn" class="input-group-addon btn"><i class="icon-search"></i></span>
		</div>
		<script>
			$(function(){
				$("#nav-search-btn").on('click',function(){
					var title = $("#nav-search").val();
					if(title&&title!=''){
						window.location.href=BASE_PATH+"/1/search.html?title="+title;
					}
				});
			});
		</script>
    </div>
    </div>
</nav>